{extend name="main/index" /}
{block name="main"}
<style type="text/css">
    .form-group .col-xs-10{
        width:200px; 
        height:40px; 
        line-height:40px; 
        border:1px solid #CCC; 
    }
    .form-group .default{
       width:200px; 
        height:32px; 
        line-height:32px; 
        color:#999;
    }
    .form-group .error{
        height:32px; 
        line-height:32px; 
        color:#F00; 
    }
    .form-group .success{
        height:32px; 
        line-height:32px; 
        color:#096; 
    }
</style>
<div class="main-content">

    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="{:url('admin/manpower/index')}">人力资源</a>
            </li>
            <li class="active">添加人力资源</li>
        </ul><!-- .breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
                <span class="input-icon">
                    <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
                    <i class="icon-search nav-search-icon"></i>
                </span>
            </form>
        </div><!-- #nav-search -->
    </div>
    <div class="page-content">
        <h3 class="header smaller lighter blue">添加人力资源</h3>
        <div class="col-xs-12">
            <form class="form-horizontal" action="{:url('admin/manpower/doaddman')}" onSubmit="return checkForm()">
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 姓名: </label>

                    <div class="col-sm-9">
                        <input type="text" name="name" class="col-xs-10 col-sm-5" id="name" onBlur="checkname()" oninput="checkname()"/>
                        <span class="default" id="nameErr"></span> 
                    </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">出生日期: </label>

                    <div class="col-sm-9">
                        <input type="date" name="birthday" class="col-xs-10 col-sm-5" id="birthday" onBlur="checkbirthday()" oninput="checkbirthday()"/>
                        <span class="default" id="birthdayErr"></span> 
                    </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">毕业院校: </label>

                    <div class="col-sm-9">
                        <input type="text" name="graduate_institutions" class="col-xs-10 col-sm-5" id="graduate" onBlur="checkgraduate()" oninput="checkgraduate()"/>
                        <span class="default" id="graduateErr"></span> 
                    </div>
                </div>

                <div class="space-4"></div>


                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">学历: </label>
                    <div class="col-sm-9">
                        <select name="education_background" class="col-xs-10" id="education" onBlur="checkeducation()" oninput="checkeducation()">
                            <option value="">请选择你的学历</option>
                            <option value="高中">高中</option>
                            <option value="中专">中专</option>
                            <option value="大专">大专</option>
                            <option value="本科">本科</option>
                            <option value="研究生">研究生</option>
                            <option value="博士">博士</option>
                            <option value="海归">海归</option>
                        </select>
                        <span class="default" id="educationErr"></span> 
                    </div>
                </div>
                <div class="space-4"></div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">专业: </label>

                    <div class="col-sm-9">
                        <select name="major" class="col-xs-10" id="major" onBlur="checkmajor()" oninput="checkmajor()">
                            <option value="">请选择你的专业</option>
                            <option value="计算机">计算机</option>
                            <option value="会计学">会计学</option>
                            <option value="英语">英语</option>
                            <option value="德语">德语</option>
                            <option value="韩语">韩语</option>
                            <option value="其他">其他</option>
                        </select>
                        <span class="default" id="majorErr"></span> 
                    </div>
                </div>

                <div class="space-4"></div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">联系方式: </label>

                    <div class="col-sm-9">
                        <input type="text" name="tel" class="col-xs-10 col-sm-5" maxlength="11" id="tel" onBlur="checktel()" oninput="checktel()"/>
                        <span class="default" id="telErr"></span> 
                    </div>
                </div>
                <div class="space-4"></div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">现任职位: </label>

                    <div class="col-sm-9">
                        <input type="text" name="incumbent_position" class="col-xs-10 col-sm-5" id="incumbent" onBlur="checkincumbent()" oninput="checkincumbent()"/>
                        <span class="default" id="incumbentErr"></span> 
                    </div>
                </div>


                <div class="space-4"></div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">入职日期: </label>

                    <div class="col-sm-9">
                        <input type="date" name="entry_time" class="col-xs-10 col-sm-5" id="entry" onBlur="checkentry()" oninput="checkentry()"/>
                        <span class="default" id="entryErr"></span>
                    </div>
                </div>


                <div class="space-4"></div>


                <!--<div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">离职日期: </label>

                    <div class="col-sm-9">
                        <input type="date" name="out_time" class="col-xs-10 col-sm-5" id="out" onBlur="checkout()" oninput="checkout()"/>
                        <span class="default" id="outErr"></span>
                    </div>
                </div>


                <div class="space-4"></div>-->

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-tags">状态</label>

                    <div class="col-sm-9">
                        <input name="status" type="radio" value="1" checked="checked">入职 |
                        <input name="status" value="0" type="radio" >投简
                    </div>
                </div>
                <!--<div class="clearfix form-actions">-->

                <div >
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit">
                            <i class="icon-ok bigger-110"></i>
                            提交
                        </button>

                        &nbsp; &nbsp; &nbsp;
                        <button class="btn" type="reset">
                            <i class="icon-undo bigger-110"></i>
                            重置
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>
<script type="text/javascript"> 
    function checkForm(){ 
        var nametip = checkname(); 
        var requirement = checkbirthday();  
        var content = checkgraduate(); 
        var logging = checkeducation(); 
        var major = checkmajor();
        var tel = checktel();
        //var incumbent = checkincumbent();
        //var entry = checkentry();
        //var out = checkout();
        return nametip && requirement && content && logging && major && tel; //&& incumbent && entry && out;
    } 
    
    function checkname(){ 
        var username = document.getElementById('name'); 
        var errname = document.getElementById('nameErr');
        var pattern = /^[\u4E00-\u9FA5A-Za-z]+$/;
        if(username.value.length == 0){ 
            errname.innerHTML="名字不能为空"
            errname.className="error"
            return false; 
        }if(!pattern.test(username.value)){ 
            errname.innerHTML="名字不合规范"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    } 

    function checkbirthday(){ 
        var username = document.getElementById('birthday'); 
        var errname = document.getElementById('birthdayErr');
        var myDate = new Date();
        var year = myDate.getFullYear();
        var month = myDate.getMonth()+1;
        var date = myDate.getDate();
        var mytime = year.toString()+-month.toString()+-date.toString();
        //console.log(mytime);
        if(username.value.length == 0){ 
            errname.innerHTML="出生日期不能为空"
            errname.className="error"
            return false; 
        }if((username.value)>mytime){ 
            errname.innerHTML="日期不合规范"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    } 

    function checkgraduate(){ 
        var username = document.getElementById('graduate'); 
        var errname = document.getElementById('graduateErr'); 
        var pattern = /^[\u4E00-\u9FA5A-Za-z]+$/;
        if(username.value.length == 0){ 
            errname.innerHTML="毕业院校不能为空"
            errname.className="error"
            return false; 
        }if(!pattern.test(username.value)){ 
            errname.innerHTML="毕业院校名称不合规范"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    }

    function checkeducation(){ 
        var username = document.getElementById('education'); 
        var errname = document.getElementById('educationErr'); 
        if(username.value.length == 0){ 
            errname.innerHTML="请选择你的学历"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    }

    function checkmajor(){ 
        var username = document.getElementById('major'); 
        var errname = document.getElementById('majorErr'); 
        if(username.value.length == 0){ 
            errname.innerHTML="请选择你的专业"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    }

    function checktel(){ 
        var username = document.getElementById('tel'); 
        var errname = document.getElementById('telErr'); 
        var pattern = /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/;
        if(username.value.length == 0){ 
            errname.innerHTML="请填写你的手机号"
            errname.className="error"
            return false; 
        }if(!pattern.test(username.value)){ 
            errname.innerHTML="手机号不合规范"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    }

    /*function checkincumbent(){ 
        var username = document.getElementById('incumbent'); 
        var errname = document.getElementById('incumbentErr'); 
        if(username.value.length == 0){ 
            errname.innerHTML="现任职位不能为空"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    }


    function checkentry(){ 
        var username = document.getElementById('entry'); 
        var errname = document.getElementById('entryErr');
        var myDate = new Date();
        var year = myDate.getFullYear();
        var month = myDate.getMonth()+1;
        var date = myDate.getDate();
        var mytime = year.toString()+-month.toString()+-date.toString();
        //console.log(mytime);
        if(username.value.length == 0){ 
            errname.innerHTML="入职日期不能为空"
            errname.className="error"
            return false; 
        }if((username.value)>mytime){ 
            errname.innerHTML="日期不合规范"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    } 

    function checkout(){ 
        var username = document.getElementById('out'); 
        var errname = document.getElementById('outErr');
        var entry = document.getElementById('entry')
        //console.log(mytime);
        if(username.value.length == 0){ 
            errname.innerHTML="日期不能为空"
            errname.className="error"
            return false; 
        }if((username.value)<(entry.value)){ 
            errname.innerHTML="不能小于入职日期"
            errname.className="error"
            return false; 
        }else{ 
            errname.innerHTML="OK"
            errname.className="success"; 
            return true; 
        } 
    } */
</script>


{/block}